package com.ray.test.mock;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author bo shen
 * @Description:
 * @Class: MocKFactory
 * @Package com.ray.test.mock
 * @date 2019/12/12 18:42
 * @company <p>杭州传化陆鲸科技有限公司</p>
 * @updateRecord time(修改时间)  author(修改人)   desc(修改内容)
 */
public class MocKFactory {

    private  static Map<Class<?>,DataMock> dataMockMap = new HashMap();

    private static InterfaceDataMock interfaceDataMock = new InterfaceDataMock();

    private static ArrayDataMock arrayDataMock = new ArrayDataMock();
    static {
        dataMockMap.put(Map.class,new MapDataMock());
        dataMockMap.put(List.class,new ListDataMock());
        dataMockMap.put(Set.class,new SetDataMock());
    }

   public static  DataMock getDataMock(Class<?> clazz){
       DataMock dataMock =  dataMockMap.get(clazz);
       if(dataMock == null){
           dataMock = new ClassDataMock();
       }
       return  dataMock;
   }

    public static DataMock getArrayDataMock() {
        return arrayDataMock;
    }

    public static DataMock getInterfaceDataMock() {
        return interfaceDataMock;
    }
}
